Set Attributes Action Icon

Set Attributes Action

Declaration

<AMSETATTRIBUTES SOURCE="text" SUBFOLDERS="yes/no" ISNEWERTHAN="datetime" ISOLDERTHAN="datetime" ATTRIBUTES="text (+/-RASH combination)" ATTRFILTER="text (+/-RASH combination)" EXCLUDE="text">

See Also

Copy File, Move File, Delete File, Delete Folder, Rename Folder

Description

Sets the attributes of the file(s) specified in the Source parameter to the attribute mask you specify.

Practical Usage

Usually used to rename a single file, multiple files.

Parameters

General Tab

Source
Text, Required
MARKUP:
a) SOURCE="c:\sourcefoldername\file.txt"
b) SOURCE="c:\sourcefoldername\*.txt"
c) SOURCE="C:\sourcefoldername\*.txt|C:\sourcefoldername\*.doc"
c) SOURCE="file.txt"

Specifies the file(s) to that should be affected by the attribute change. This can be a fully qualified path and filename (preferred) or a single file (requires use of the Change Folder action). Wildcards ( e.g. *.* or ? ) may be used to rename files matching a certain mask. Multiple file and/or file masks may be specified by separating the entries with the | symbol.

Attributes
Text, Required
MARKUP:
a) ATTRIBUTES="+A+H" (turn on archive and hidden attributes)
b) ATTRIBUTES="-R-S-H" (turn off read-only,hidden and system attributes)
c) ATTRIBUTES="-R-A+S+H" (turn on read-only and archive -- turn on hidden and system attributes)

Specified the attribute combination that the file(s) should be changed to reflect. In Visual mode simply specify which attributes to change and yes/no to each selected attribute.

In AML mode, specify a RASH style text parameter that reflects which attributes to switch on and off.

Using the RASH Attribute System:
+ is Turn On
- is Turn Off

R - Read Only
A - Archive
S - System
H - Hidden

For Example:

+R means turn on the Read only property, - R would mean turn it off, not specifying the R as a part of the text would ignore it.
+A means turn on the Archive property, - A would mean turn it off, not specifying the A as a part of the text would ignore it.

To change several attributes in a single pass, simply put them together:

+R-A-S+H would turn on the Read Only and Hidden attributes and turn off Archive and System.

+R+S+H would turn on the Read Only and Hidden attributes and System. Archive would be left as is.
 

 

Options Tab

Include subfolders
Yes/No, Optional default - NO
MARKUP: SUBFOLDERS="YES"

When set to YES, specifies that, if present, subfolders should be searched for files matching the mask (or same filename) specified in the "Source" [SOURCE] parameter.

Exclude Mask
Text, Optional default - (blank)
MARKUP: EXCLUDE="*.txt"

Causes the action to not change the attributes of files matching the mask(s) specified. Filenames or wildcard ( e.g. * or ? ) masks may be used, multiple entries may be specified by separating them with the | symbol (e.g. *.txt|*.bak).

Only if newer than
date, Optional default - (none)
MARKUP: ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only change the attributes of file(s) if the file is newer than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored.

Only if older than
date, Optional default - (none)
MARKUP: ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only change the attributes of file(s) if the source is older than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored.

Attributes Tab

Attributes
Text, Optional (blank)
MARKUP:
ATTRFILTER="+R+A-S-H" (rename Read Only and Archive files, not system or hidden)
ATTRFILTER="-S" (do not rename "system" files)

This group of settings causes the action to filter which files are affected by the attribute change based on the original attribute settings of the source file(s). In visual mode, a group of controls are provided to assist in the selection of this parameter.

In AML mode, a single text item must be built and specified that contains the original attribute mask of the files you wish to affect.

Available Options:

R - Read only - Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

A - Archive - Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

S - System - Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

H - Hidden - Specifying "+R" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

C - Compression - Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

Notes

Standard Error Handling Options
This action also includes the standard "Error Causes" and "On Error" failure handling options/tabs

More on Error Handling Options

Variables and Expressions
All text fields allow the use of expressions by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, a popup expression builder is available in all these fields by pressing F2.
More on variables...

More on expressions...

More on the expression builder...

Example

<AMSETATTRIBUTES SOURCE="c:\myfile.txt" ATTRIBUTES="+s" >

<AMSETATTRIBUTES SOURCE="C:\myfolder\*.txt" SUBFOLDERS="YES" ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" ATTRIBUTES="+r-a-s" ATTRFILTER="+r+a+s+h+c" EXCLUDE="*.avi">